package br.com.j7.jdesk.persistence.repository.impl;

import java.util.List;

import br.com.j7.jdesk.library.exception.RepositoryException;
import br.com.j7.jdesk.persistence.entity.ServicesStates;
import br.com.j7.jdesk.persistence.repository.ServiceStateRepository;

public class ServiceStateRepositoryImpl extends AbstractRepository<ServicesStates> implements ServiceStateRepository{


	/*
	 * (non-Javadoc)
	 * @see br.com.j7.jdesk.persistence.repository.impl.AbstractRepository#list()
	 */
	@Override
	public List<ServicesStates> list() throws RepositoryException {
		try {
			return listByNamedQuery(ServicesStates.class, "serviceState");
		} catch (RepositoryException e) {
			throw new RepositoryException(e);
		}
	}

	/*
	 * (non-Javadoc)
	 * @see br.com.j7.jdesk.persistence.repository.impl.AbstractRepository#find(java.lang.Integer)
	 */
	@Override
	public ServicesStates find(Integer id) throws RepositoryException {
		try {
			return getEntity(ServicesStates.class, id);
		} catch (RepositoryException e) {
			throw new RepositoryException(e);
		}
	}

	/*
	 * (non-Javadoc)
	 * @see br.com.j7.jdesk.persistence.repository.ServiceStateRepository#findByState(java.lang.String)
	 */
	@Override
	public ServicesStates findByState(String cdState) throws RepositoryException {
		try {
			return getEntity(ServicesStates.class, "serviceStateByCdState", cdState);
		} catch (RepositoryException e) {
			throw new RepositoryException(e);
		}
	}

}
